home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / manageme / tcpdump-.001 / tcpdump-~ / tcpdump-3.0.2-linux / linux-include / netinet / ip_var.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-30  |  3.1 KB  |  108 lines

  1. /*    @(#)ip_var.h 1.11 88/08/19 SMI; from UCB 7.1 6/5/86    */
  2.  
  3. /*
  4.  * Copyright (c) 1982, 1986 Regents of the University of California.
  5.  * All rights reserved.  The Berkeley software License Agreement
  6.  * specifies the terms and conditions for redistribution.
  7.  */
  8.  
  9. /*
  10.  * Overlay for ip header used by other protocols (tcp, udp).
  11.  */
  12.  
  13. #ifndef _netinet_ip_var_h
  14. #define _netinet_ip_var_h
  15.  
  16. struct ipovly {
  17.     caddr_t    ih_next, ih_prev;    /* for protocol sequence q's */
  18.     u_char    ih_x1;            /* (unused) */
  19.     u_char    ih_pr;            /* protocol */
  20.     short    ih_len;            /* protocol length */
  21.     struct    in_addr ih_src;        /* source internet address */
  22.     struct    in_addr ih_dst;        /* destination internet address */
  23. };
  24.  
  25. /*
  26.  * Ip reassembly queue structure.  Each fragment
  27.  * being reassembled is attached to one of these structures.
  28.  * They are timed out after ipq_ttl drops to 0, and may also
  29.  * be reclaimed if memory becomes tight.
  30.  */
  31. struct ipq {
  32.     struct    ipq *next,*prev;    /* to other reass headers */
  33.     u_char    ipq_ttl;        /* time for reass q to live */
  34.     u_char    ipq_p;            /* protocol of this fragment */
  35.     u_short    ipq_id;            /* sequence id for reassembly */
  36.     struct    ipasfrag *ipq_next,*ipq_prev;
  37.                     /* to ip headers of fragments */
  38.     struct    in_addr ipq_src,ipq_dst;
  39. };
  40.  
  41. /*
  42.  * Ip header, when holding a fragment.
  43.  *
  44.  * Note: ipf_next must be at same offset as ipq_next above
  45.  */
  46. struct    ipasfrag {
  47. #if defined(vax) || defined(i386)
  48.     u_char    ip_hl:4,
  49.         ip_v:4;
  50. #endif
  51. #if defined(mc68000) || defined(sparc)
  52.     u_char    ip_v:4,
  53.         ip_hl:4;
  54. #endif
  55.     u_char    ipf_mff;        /* copied from (ip_off&IP_MF) */
  56.     short    ip_len;
  57.     u_short    ip_id;
  58.     short    ip_off;
  59.     u_char    ip_ttl;
  60.     u_char    ip_p;
  61.     u_short    ip_sum;
  62.     struct    ipasfrag *ipf_next;    /* next fragment */
  63.     struct    ipasfrag *ipf_prev;    /* previous fragment */
  64. };
  65.  
  66. /*
  67.  * Structure stored in mbuf in inpcb.ip_options
  68.  * and passed to ip_output when ip options are in use.
  69.  * The actual length of the options (including ipopt_dst)
  70.  * is in m_len.
  71.  */
  72. #define MAX_IPOPTLEN    40
  73.  
  74. struct ipoption {
  75.     struct    in_addr ipopt_dst;    /* first-hop dst if source routed */
  76.     char    ipopt_list[MAX_IPOPTLEN];    /* options proper */
  77. };
  78.  
  79. struct    ipstat {
  80.     long    ips_total;        /* total packets received */
  81.     long    ips_badsum;        /* checksum bad */
  82.     long    ips_tooshort;        /* packet too short */
  83.     long    ips_toosmall;        /* not enough data */
  84.     long    ips_badhlen;        /* ip header length < data size */
  85.     long    ips_badlen;        /* ip length < ip header length */
  86.     long    ips_fragments;        /* fragments received */
  87.     long    ips_fragdropped;    /* frags dropped (dups, out of space) */
  88.     long    ips_fragtimeout;    /* fragments timed out */
  89.     long    ips_forward;        /* packets forwarded */
  90.     long    ips_cantforward;    /* packets rcvd for unreachable dest */
  91.     long    ips_redirectsent;    /* packets forwarded on same net */
  92. };
  93.  
  94. #ifdef KERNEL
  95. /* flags passed to ip_output as last parameter */
  96. #define    IP_FORWARDING        0x1        /* most of ip header exists */
  97. #define    IP_ROUTETOIF        SO_DONTROUTE    /* bypass routing tables */
  98. #define    IP_ALLOWBROADCAST    SO_BROADCAST    /* can send broadcast packets */
  99.  
  100. struct    ipstat    ipstat;
  101. struct    ipq    ipq;            /* ip reass. queue */
  102. u_short    ip_id;                /* ip packet ctr, for ids */
  103.  
  104. struct    mbuf *ip_srcroute();
  105. #endif
  106.  
  107. #endif /*!_netinet_ip_var_h*/
  108.